
 
 F u n c t i o n :   a d d W i d g e t P r o f i l e ( s t r i n g W i d g e t T y p e N a m e ,   o b j e c t C o n f i g ) 
 
 
 
 D e s c r i p t i o n :   C r e a t e s   a   w i d g e t   t y p e   p r o f i l e   t h a t   w i l l   a u t o m a t i c a l l y   l o a d   s h a r e d   p r o p e r t i e s   a n d   m e t h o d s   w h e n   a   D C   o b j e c t   i s   r e n d e r e d . 
 
 
 
 R e t u r n s :   N u l l . 
 
 
 
 N o t e :   A   w i d g e t   t y p e   p r o f i l e   i s   o n l y   a c t i v a t e d   w h e n   t h e   D C . w i d g e t T y p e   p r o p e r t y   i s   s e t   u s i n g   t h e   m a t c h i n g   n a m e   f o r   t h a t   p r o f i l e .   T h e   c o n f i g u r a t i o n   o b j e c t   s y n t a x   i s   s t r i c t ,   a n d   m u s t   b e   f o l l o w e d   e x a c t l y   t o   e n s u r e   t h a t   p r o f i l e   c h a n g e s   a r e   c o r r e c t l y   i m p o r t e d   w h e n   a   D C   o b j e c t   i s   r e n d e r e d . 
 
 
 
 C o n f i g u r a t i o n : 
 
 
 
 { 
 
 
 
     c o n f i g u r e :   f u n c t i o n ( D C )   { 
 
         / /   M u s t   r e t u r n   a n   o b j e c t   f o r   s e t t i n g   i n i t i a l   p r o p e r t i e s   a n d   m e t h o d s   o n   t h e   D C   o b j e c t . 
 
         r e t u r n   { 
 
             / /   I n i t i a l   p r o p e r t i e s   a n d   m e t h o d s   f o r   t h e   w i d g e t   D C   o b j e c t   w h e n   i n s t a n t i a t e d . 
 
         } ; 
 
     } , 
 
 
 
     r o l e :   f u n c t i o n ( D C )   { 
 
         / /   M u s t   r e t u r n   a n   o b j e c t   f o r   s e t t i n g   a t t r i b u t e s   o n   t h e   D C . w r a p p e r   e l e m e n t   w h e n   r e n d e r e d . 
 
         r e t u r n   { 
 
             / /   A t t r i b u t e   p r o p e r t y :   v a l u e   p a i r s . 
 
         } ; 
 
     } , 
 
 
 
     i n n e r R o l e :   f u n c t i o n ( D C )   { 
 
         / /   M u s t   r e t u r n   a n   o b j e c t   f o r   s e t t i n g   a t t r i b u t e s   o n   t h e   D C . c o n t a i n e r   e l e m e n t   w h e n   r e n d e r e d . 
 
         / /   O n l y   a p p l i c a b l e   w h e n   D C . c o n t e n t O n l y   i s   f a l s e ,   o r   w h e n   D C . e x p o s e B o u n d s   i s   t r u e . 
 
         r e t u r n   { 
 
             / /   A t t r i b u t e   p r o p e r t y :   v a l u e   p a i r s . 
 
         } ; 
 
     } , 
 
 
 
     a f t e r F e t c h :   f u n c t i o n ( D C ,   c o n t a i n e r )   { 
 
         / /   H a s   n o   r e t u r n   r e s t r i c t i o n s . 
 
         / /   E x e c u t e s   d i r e c t l y   a f t e r   e x t e r n a l   c o n t e n t   i s   l o a d e d   u s i n g   t h e   F e t c h   A P I . 
 
     } , 
 
 
 
     b e f o r e R e n d e r :   f u n c t i o n ( D C ,   c o n t a i n e r )   { 
 
         / /   H a s   n o   r e t u r n   r e s t r i c t i o n s . 
 
         / /   E x e c u t e s   b e f o r e   t h e   w i d g e t   i s   r e n d e r e d   i n   t h e   D O M . 
 
     } , 
 
 
 
     d u r i n g R e n d e r :   f u n c t i o n ( D C ,   c o n t a i n e r )   { 
 
         / /   H a s   n o   r e t u r n   r e s t r i c t i o n s . 
 
         / /   E x e c u t e s   w h i l e   t h e   w i d g e t   i s   b e i n g   r e n d e r e d   i n   t h e   D O M . 
 
     } , 
 
 
 
     a f t e r R e n d e r :   f u n c t i o n ( D C ,   c o n t a i n e r )   { 
 
         / /   H a s   n o   r e t u r n   r e s t r i c t i o n s . 
 
         / /   E x e c u t e s   d i r e c t l y   a f t e r   t h e   w i d g e t   i s   r e n d e r e d   i n   t h e   D O M . 
 
     } , 
 
 
 
     b e f o r e R e m o v e :   f u n c t i o n ( D C ,   c o n t a i n e r )   { 
 
         / /   H a s   n o   r e t u r n   r e s t r i c t i o n s . 
 
         / /   E x e c u t e s   b e f o r e   t h e   w i d g e t   i s   r e m o v e d   f r o m   t h e   D O M . 
 
     } , 
 
 
 
     a f t e r R e m o v e :   f u n c t i o n ( D C ,   c o n t a i n e r )   { 
 
         / /   H a s   n o   r e t u r n   r e s t r i c t i o n s . 
 
         / /   E x e c u t e s   a f t e r   t h e   w i d g e t   i s   r e m o v e d   f r o m   t h e   D O M . 
 
     } 
 
 
 
 } 
 
 
 
 E x a m p l e : 
 
 
 
 $ A . a d d W i d g e t P r o f i l e ( " L o g i n D i a l o g " ,   { 
 
 
 
     / /   S e t   i n i t i a l   c o n f i g u r a t i o n   p r o p e r t i e s   a n d   m e t h o d s   f o r   t h e   w i d g e t   D C   o b j e c t   w h e n   i n s t a n t i a t e d . 
 
     / /   F o r   h e l p   w i t h   D C   A P I   f e a t u r e s   a n d   o p t i o n s ,   v i e w :   " / H e l p / D C   A P I " . 
 
     c o n f i g u r e :   f u n c t i o n ( d c )   { 
 
         r e t u r n   { 
 
             i s M o d a l :   t r u e , 
 
             i s A l e r t :   f a l s e , 
 
             e x p o s e B o u n d s :   t r u e , 
 
             f o r c e F o c u s :   t r u e , 
 
             r e t u r n F o c u s :   t r u e , 
 
             e x p o s e H i d d e n C l o s e :   t r u e , 
 
             c i r c u l a r T a b b i n g :   t r u e , 
 
             p r e l o a d :   t r u e , 
 
             p r e l o a d I m a g e s :   t r u e , 
 
             p r e l o a d C S S :   t r u e , 
 
             c l a s s N a m e :   " m o d a l " , 
 
             r o o t :   " b o d y " , 
 
             a p p e n d :   t r u e , 
 
             o n :   " c l i c k " , 
 
             c l i c k :   f u n c t i o n ( e v ,   d c )   { 
 
 e v . s t o p P r o p a g a t i o n ( ) ; 
 
             } , 
 
             / /   A d d   a n i m a t i o n   e f f e c t s   w h e n   a   D C   o b j e c t   i s   r e n d e r e d   o r   r e m o v e d . 
 
             a n i m a t e :   { 
 
                 o n R e n d e r :   f u n c t i o n ( D C ,   w r a p p e r ,   n e x t )   { 
 
                     / /   O p t i o n a l l y   a d d   a n   a n i m a t i o n   e f f e c t   w h e n   t h e   c o m p o n e n t   i s   r e n d e r e d . 
 
                     / /   T o   e n s u r e   a c c e s s i b i l i t y ,   m a k e   s u r e   t h a t   t h e   n e x t ( )   f u n c t i o n   i s   e x e c u t e d   w i t h i n   t h e   c a l l b a c k   a f t e r   t h e   a n i m a t i o n   f i n i s h e s . 
 
                     n e x t ( ) ; 
 
                 } , 
 
                 o n R e m o v e :   f u n c t i o n ( D C ,   w r a p p e r ,   n e x t )   { 
 
                     / /   O p t i o n a l l y   a d d   a n   a n i m a t i o n   e f f e c t   w h e n   t h e   c o m p o n e n t   i s   r e m o v e d . 
 
                     / /   T o   e n s u r e   a c c e s s i b i l i t y ,   m a k e   s u r e   t h a t   t h e   n e x t ( )   f u n c t i o n   i s   e x e c u t e d   w i t h i n   t h e   c a l l b a c k   a f t e r   t h e   a n i m a t i o n   f i n i s h e s . 
 
                     n e x t ( ) ; 
 
                 } 
 
             } , 
 
             a f t e r R e n d e r :   f u n c t i o n ( D C )   { 
 
                 / /   C o n f i g u r e   a c t i o n s   f o r   t h e   l o g i n   f o r m   w i t h i n   D C . c o n t a i n e r   
 
             } 
 
         } ; 
 
     } , 
 
 
 
     r o l e :   f u n c t i o n ( d c )   { 
 
         / /   R e t u r n   t h e   p r o p e r t y   /   v a l u e   o b j e c t   f o r   s e t t i n g   t h e   c o r r e c t   r o l e   a n d   s u p p o r t i n g   a t t r i b u t e s   o n   D C . w r a p p e r   w h e n   r e n d e r e d . 
 
         v a r   r   =   { } ; 
 
         r . r o l e   =   d c . i s A l e r t   ?   " a l e r t d i a l o g "   :   " d i a l o g " ; 
 
         r [ " a r i a - m o d a l " ]   =   i s M o d a l   ?   " t r u e "   :   " f a l s e " ; 
 
         r e t u r n   r ; 
 
     } , 
 
 
 
     / /   C r e a t e   a   t r a c k i n g   v a r i a b l e   w i t h i n   t h e   p r o f i l e   o b j e c t   f o r   u s e   i n t e r n a l l y . 
 
     t r a c k :   [ ] , 
 
 
 
     / /   E x e c u t e   a f t e r   t h e   D C   o b j e c t   c o m p l e t e s   r e n d e r i n g ,   b e f o r e   t h e   r e m a i n i n g   l i f e c y c l e   m e t h o d s   a r e   i n v o k e d . 
 
     a f t e r R e n d e r :   f u n c t i o n ( d c ,   c o n t a i n e r )   { 
 
         t h i s . t r a c k . p u s h ( d c ) ; 
 
         i f   ( d c . i s M o d a l ) 
 
             d c . b a c k d r o p   =   $ A ( t h i s . b a c k d r o p ) 
 
 . o n ( { 
 
     c l i c k :   f u n c t i o n ( e v )   { 
 
         d c . r e m o v e ( ) ; 
 
         e v . s t o p P r o p a g a t i o n ( ) ; 
 
     } 
 
 } ) 
 
 . a p p e n d T o ( d c . w r a p p e r ) 
 
 . r e t u r n ( ) ; 
 
     } , 
 
 
 
     / /   E x e c u t e   a f t e r   t h e   D C   o b j e c t   i s   r e m o v e d   f r o m   t h e   D O M ,   b e f o r e   t h e   r e m a i n i n g   l i f e c y c l e   m e t h o d s   a r e   i n v o k e d . 
 
     a f t e r R e m o v e :   f u n c t i o n ( d c ,   c o n t a i n e r )   { 
 
         t h i s . t r a c k . s p l i c e ( t h i s . t r a c k . l e n g t h   -   1 ,   1 ) ; 
 
         i f   ( t h i s . t r a c k . l e n g t h ) 
 
             d c . r e r o u t e F o c u s   =   t h i s . t r a c k [ t h i s . t r a c k . l e n g t h   -   1 ] ; 
 
     } , 
 
 
 
     / /   A d d   a   b a c k d r o p   m a r k u p   p r o p e r t y   t h a t   c a n   b e   u s e d   w h e n   n e e d e d   w i t h i n   t h e   p r o f i l e   o b j e c t . 
 
     b a c k d r o p :   ' < d i v   c l a s s = " m o d a l B a c k d r o p " > & n b s p ; < / d i v > ' 
 
 
 
 } ) ; 
 
 